package com.seedeer.project.domain.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.seedeer.common.support.convert.IConvertEnum;

/**
 * 操作人类别
 *
 * @author wangqiang
 */
public enum OperatorType implements IConvertEnum<Integer> {
    /**
     * 其它
     */
    OTHER(0),

    /**
     * 后台用户
     */
    MANAGE(1),

    /**
     * 手机端用户
     */
    MOBILE(2);

    @EnumValue
    private final Integer value;

    OperatorType(Integer value) {
        this.value = value;
    }

    @JsonCreator
    public static OperatorType getOperatorType(Integer value) {
        for (OperatorType item : values()) {
            if (item.getValue().equals(value)) {
                return item;
            }
        }
        return null;
    }

    @JsonValue
    @Override
    public Integer getValue() {
        return value;
    }
}
